package com.xyazm.fulfill.remote;


import com.xyazm.common.core.JsonResult;
import com.xyazm.common.utils.CheckResultUtil;
import com.xyazm.tms.api.ITmsApi;
import com.xyazm.tms.domain.dto.SendOutDTO;
import com.xyazm.tms.domain.param.SendOutParam;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

/**
 * tms服务远程接口
 * @author xuyou
 * 2022-11-20 22:01
*/
@Component
public class TmsRemote {


    /**
     * 物流服务
     */
    @DubboReference(version = "1.0.0", retries = 0)
    private ITmsApi tmsApi;


    /**
     * 物流发货
     * @author xuyou
     * 2022-12-10 22:29
     * @param sendOutParam
    */
    public SendOutDTO sendOut(SendOutParam sendOutParam) {
        JsonResult<SendOutDTO> result = tmsApi.sendOut(sendOutParam);
        CheckResultUtil.checkResult(result,"物流发货");
        return result.getData();
    }


    /**
     * 取消发货
     */
    public void cancelSendOut(String orderId) {
        JsonResult<Void> result = tmsApi.cancelSendOut(orderId);
        CheckResultUtil.checkResult(result,"取消发货");
    }

}
